<h1 class="page-header">
    <small>核销记录</small>
</h1>
<hr/>
<div class="panel panel-inverse" data-sortable-id="form-stuff-5">
    <div class="panel-heading">
        <h4 class="panel-title">核销记录查询</h4>
    </div>
    <div class="panel-body">
        <form id="memberForm" name="memberForm" method="post" class="form-inline">
            <div class="block clearfix" style="display: block;height: 45px;">
                <div class="form-group  m-r-20">
                    <input type="text" class="form-control" id="GTE_usedTime" name="GTE_usedTime" autocomplete="off" value="${params.GTE_usedTime}"
                           placeholder="起始时间">-
                    <input type="text" class="form-control" id="LTE_usedTime" name="LTE_usedTime" autocomplete="off" value="${params.LTE_usedTime}"
                           placeholder="结束时间">
                </div>
                <div class="form-group m-r-20">
                    <input type="text" class="form-control" name="LIKE_mobile" value="${params.LIKE_mobile}"
                           placeholder="手机号码">
                </div>
                <div class="form-group m-r-20">
                    <input type="text" class="form-control" name="EQ_Code" value="${params.EQ_Code}"
                           placeholder="消费记录号">
                </div>
                <div class="form-group m-r-20">
                    <input type="text" class="form-control" name="EQ_groupId" value="${params.EQ_groupId}"
                           placeholder="分组ID">
                </div>
                <div class="form-group m-r-20">
                    <input type="text" class="form-control" name="LIKE_couponGroupName" value="${params.LIKE_couponGroupName}"
                           placeholder="分组名称">
                </div>
            </div>
            <div class="block clearfix" style="display: block;height: 45px;">
                <div class="form-group m-r-20">
                    <input type="text" class="form-control" name="EQ_couponId" value="${params.EQ_couponId}"
                           placeholder="券ID">
                </div>
                <div class="form-group m-r-20">
                    <input type="text" class="form-control" name="LIKE_couponName" value="${params.LIKE_couponName}"
                           placeholder="券名称">
                </div>
                <div class="form-group m-r-20">
                    <select class="form-control" name="EQ_storeId" id="EQ_storeId">
                        <option value="">使用店铺</option>
                        <#if storeList?has_content && storeList?exists>
                        <#list storeList as pf>
                        <option value="${pf.id}" <#if params.EQ_storeId== pf.id> selected</#if>>${pf.name}</option>
                        </#list>
                        </#if>
                    </select>
                </div>
               <div class="form-group m-r-20">
                    <button type="button" class="btn btn-sm btn-success m-r-5"
                            onclick="postDataByForm('backend/confirmLog/confirmLogList','displayArea','memberForm')"><i class="fa fa-search"></i>查询
                    </button>
                    <button type="button" class="btn btn-sm btn-success m-r-5"
                            onclick="exportExcel();"><i class="fa fa-sign-out"></i>导出excel
                    </button>&nbsp;<label style="color:#E53333;">(一次导出表格不可超过50000条，否则可能导致出错哦)</label>
               </div>
           </div>
        </form>
    </div>
</div>
<hr/>
<div class="panel panel-inverse" data-sortable-id="table-basic-4">
    <div class="panel-heading">
        <h4 class="panel-title">消费记录</h4>
    </div>
    <div class="panel-body">
        <table class="table table-striped table-bordered">
            <thead>
            <tr>
                <th>记录号</th>
                <th>手机号</th>
                <th>分组名称</th>
                <th>卡券ID</th>
                <th>卡券名称</th>
                <th>金额</th>
                <th>使用店铺</th>
                <th>消费时间</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <#if paginationResponse?has_content && paginationResponse.content?exists && paginationResponse.content?size gt 0>
                <#list paginationResponse.content as ct>
                    <tr>
                        <td>${ct.code}</td>
                        <td>${ct.mobile}</td>
                        <td>${ct.couponGroupName}</td>
                        <td>${ct.couponId}</td>
                        <td>${ct.couponName}</td>
                        <td>${ct.money}</td>
                        <td>${ct.storeName}</td>
                        <td>${ct.confirmTime}</td>
                        <td>
                            <#if ct.confirmStatus == "A">
                            已使用
                            <#else>
                            已撤销
                        </#if>
                        </td>
                        <td>
                            <!--过期时间大于当前时间显示撤销按钮-->
                            <#if ct.couponInfoStatus == "B" && ct.confirmStatus == "A" && ct.endCancelTime gt .now?datetime>
                            <a class="label label-success small-btn" href="javascript:void(0)" onclick="javascript:getConfirmData('确定撤销${ct.mobile}的${ct.couponName}券的使用？撤销后该券可重新使用','${rc.contextPath}/backend/coupon/rollbackUserCoupon/${ct.id}?userCouponId=${ct.userCouponId}','displayArea')"><i class="fa fa-remove" title="编辑"></i>撤销</a>
                        </#if>
                        </td>
                    </tr>
                </#list>
            <#else>
            <tr class="gradeA even" role="row">
                <td colspan="12" class="text-center">没有符合条件的数据！</td>
            </tr>
            </#if>
        </table>
    </div>
</div>

<script language="JavaScript">
   function exportExcel() {
        var params = "";
        var inp =document.getElementsByTagName("input");
            for(var i=0;i<inp.length;i++){
                if(inp[i].value.length > 0){
                    params += inp[i].name+"="+inp[i].value+"&"
                }
            }
       var sel =document.getElementsByTagName("select");
           for(var i=0;i<sel.length;i++){
               if(sel[i].value.length > 0){
                   params += sel[i].name+"="+sel[i].value+"&"
               }
           }
           params+="temppara1=temppara1";
           window.open( "${rc.contextPath}/backend/confirmLog/exportConfirmLogList?" + params,"_top");
           $.close();
    }


   $('#GTE_usedTime').datetimepicker({
       lang: "ch",
       format: "Y-m-d",   //日期格式,选择时间时 格式位Y-m-d
      // format: "Y-m-d H:i",   //日期格式,选择时间时 格式位Y-m-d H:i
       timepicker: false, //是否选择时间
       yearStart: 2000,
       yearEnd: 2050,
       todayButton: true//,  //是否显示今天按钮,
       //minDate: new Date() //最小选择日期
   });
   $('#LTE_usedTime').datetimepicker({
       lang: "ch",
       format: "Y-m-d",
       timepicker: false,
       yearStart: 2000,
       yearEnd: 2050,
       todayButton: true//,
      // minDate: new Date() //最小选择日期
   });
</script>
<!-- 分页组件 -->
<!-- recordBean 分页查询结果Bean
     action 分页请求URL
     formName 分页需要的查询参数的表单名称 -->
<@sp.pagination recordBean=paginationResponse action="${rc.contextPath}/backend/confirmLog/ConfirmLogQueryList" formName="memberForm"/>
